/*
package com.unionpay.upyzt.spring.example;

import com.google.gson.Gson;
import com.unionpay.upyzt.Upyzt;
import com.unionpay.upyzt.model.BalanceAcct;
import com.unionpay.upyzt.model.CusApplication;
import com.unionpay.upyzt.model.Media;
import com.unionpay.upyzt.resp.BalanceAcctResp;
import com.unionpay.upyzt.resp.CusApplicationResp;
import com.unionpay.upyzt.resp.CusApplicationSmsCodeResp;
import com.unionpay.upyzt.resp.MediaResp;
import com.unionpay.upyzt.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import org.springframework.util.ResourceUtils;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

*/
/**
 * @author yf.zhao
 * @version 1.0
 * @since 2020/8/27
 *//*

@Slf4j
@Component
@Profile("test")
public class SdkExampleRunner implements CommandLineRunner {

    @Autowired
    private Gson gson;

    @Override
    public void run(String... args) throws Exception {
        Map<String, Object> params = new HashMap<>();
        params.put("mobile_number", "1" + StringUtils.randomNumeric(10));
        CusApplicationSmsCodeResp cusApplicationSmsCodeResp = CusApplication.sendSmsCode(params);
        log.info("------- 个人用户进件-短信验证码 ------- {} ", cusApplicationSmsCodeResp.getMobileNumber());

        MediaResp mediaResp = Media.uploadImage(ResourceUtils.getFile("classpath:static/id_card_sample.jpg"));

        Map<String, Object> idCard = new HashMap<>();
        idCard.put("copy", mediaResp.getMediaId());
        idCard.put("national", mediaResp.getMediaId());
        idCard.put("number", Upyzt.encryptField("3101002000011" + StringUtils.randomNumeric(5)));
        idCard.put("name", Upyzt.encryptField("张三"));
        idCard.put("valid_time", "2001-01-01,2050-01-01");

        Map<String, Object> settleAcct = new HashMap<>();
        settleAcct.put("bank_code", "104100000004");
        settleAcct.put("name", Upyzt.encryptField("张三"));
        settleAcct.put("bank_address_code", "110105");
        settleAcct.put("bank_branch_code", "001588044013");
        settleAcct.put("bank_acct_no", Upyzt.encryptField("123456789"));

        params.put("out_request_no", UUID.randomUUID().toString());
        params.put("id_card", idCard);
        params.put("mobile_number", Upyzt.encryptField(cusApplicationSmsCodeResp.getMobileNumber()));
        params.put("settle_acct", settleAcct);
        params.put("sms_code", "999999");
        params.put("password", Upyzt.encryptField("pa55w0rd"));

        CusApplicationResp cusApplicationResp = CusApplication.create(params);
        log.info("------- 个人用户首次进件 ------- {} ", cusApplicationResp.getBalanceAcctId());

        BalanceAcctResp balanceAcctResp = BalanceAcct.retrieveById(cusApplicationResp.getBalanceAcctId());
        log.info("------- 电子账簿查询 ------- {} ", gson.toJson(balanceAcctResp));
    }
}
*/
